package apiday04.file;

import java.io.File;

public class ListFilesDemo {
    public static void main(String[] args) {
        File dir = new File("C:/");
        if(dir.isDirectory()){
            File[] files = dir.listFiles();
            System.out.println("一共有"+files.length+"个子项");
            for (File file: files) {
                System.out.println(file.getName());
            }
        }
    }
}
